home *** CD-ROM | disk | FTP | other *** search
/ ADA Programming Guide / ADA Programming Guide.iso / ada_gnu / adainc / s-os2syn.ads < prev    next >
Text File  |  1996-01-30  |  7KB  |  195 lines

  1. ------------------------------------------------------------------------------
  2. --                                                                          --
  3. --                 GNU ADA RUNTIME LIBRARY (GNARL) COMPONENTS               --
  4. --                                                                          --
  5. --        S Y S T E M . O S 2 L I B . S Y N C H R O N I Z A T I O N         --
  6. --                                                                          --
  7. --                                  S p e c                                 --
  8. --                                                                          --
  9. --                             $Revision: 1.4 $                             --
  10. --                                                                          --
  11. --             Copyright (c) 1993,1994 NYU, All Rights Reserved             --
  12. --                                                                          --
  13. --  GNARL is free software; you can redistribute it and/or modify it  under --
  14. --  terms  of  the  GNU  Library General Public License as published by the --
  15. --  Free Software Foundation; either version 2,  or (at  your  option)  any --
  16. --  later  version.   GNARL is distributed in the hope that it will be use- --
  17. --  ful, but but WITHOUT ANY WARRANTY; without even the implied warranty of --
  18. --  MERCHANTABILITY  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Gen- --
  19. --  eral Library Public License for more details.  You should have received --
  20. --  a  copy of the GNU Library General Public License along with GNARL; see --
  21. --  file COPYING. If not, write to the Free Software Foundation,  675  Mass --
  22. --  Ave, Cambridge, MA 02139, USA.                                          --
  23. --                                                                          --
  24. ------------------------------------------------------------------------------
  25.  
  26. with Interfaces.C;          use Interfaces.C;
  27. with System;                use System;
  28. with System.OS2Lib.Threads; use System.OS2Lib.Threads;
  29.  
  30. package System.OS2Lib.Synchronization is
  31. pragma Preelaborate (Synchronization);
  32.  
  33.    --  Semaphore Attributes
  34.  
  35.    DC_SEM_SHARED : constant := 16#01#;
  36.    --  DosCreateMutex, DosCreateEvent, and DosCreateMuxWait use it to indicate
  37.    --  whether the semaphore is shared or private when the PSZ is null
  38.  
  39.    DCMW_WAIT_ANY : constant := 16#02#;
  40.    --  DosCreateMuxWait option for wait on any event/mutex to occur
  41.  
  42.    DCMW_WAIT_ALL : constant := 16#04#;
  43.    --  DosCreateMuxWait option for wait on all events/mutexes to occur
  44.  
  45.    SEM_INDEFINITE_WAIT  : constant ULONG := -1;
  46.    SEM_IMMEDIATE_RETURN : constant ULONG :=  0;
  47.  
  48.    type HSEM is new System.Address;
  49.    type PHSEM is access all HSEM;
  50.  
  51.    type SEMRECORD is
  52.       record
  53.          hsemCur : HSEM;
  54.          ulUser  : ULONG;
  55.       end record;
  56.    type PSEMRECORD is access all SEMRECORD;
  57.  
  58.  
  59.    type HEV is new unsigned_long;
  60.    type PHEV is access all HEV;
  61.  
  62.    type HMTX is new unsigned_long;
  63.    type PHMTX is access all HMTX;
  64.    type HMUX is new unsigned_long;
  65.    type PHMUX is access all HMUX;
  66.  
  67.    function DosCreateEventSem
  68.      (pszName   : PSZ;
  69.       f_phev    : PHEV;
  70.       flAttr    : ULONG;
  71.       fState    : BOOL32)
  72.       return      APIRET;
  73.    pragma Import (C, DosCreateEventSem, Link_Name => "DosCreateEventSem");
  74.  
  75.    function DosOpenEventSem
  76.      (pszName   : PSZ;
  77.       F_phev    : PHEV)
  78.       return      APIRET;
  79.    pragma Import (C, DosOpenEventSem, Link_Name => "DosOpenEventSem");
  80.  
  81.    function DosCloseEventSem
  82.      (F_hev     : HEV)
  83.       return      APIRET;
  84.    pragma Import (C, DosCloseEventSem, Link_Name => "DosCloseEventSem");
  85.  
  86.    function DosResetEventSem
  87.      (F_hev     : HEV;
  88.       pulPostCt : PULONG)
  89.       return      APIRET;
  90.    pragma Import (C, DosResetEventSem, Link_Name => "DosResetEventSem");
  91.  
  92.    function DosPostEventSem
  93.      (F_hev     : HEV)
  94.       return      APIRET;
  95.    pragma Import (C, DosPostEventSem, Link_Name => "DosPostEventSem");
  96.  
  97.    function DosWaitEventSem
  98.      (F_hev     : HEV;
  99.       ulTimeout : ULONG)
  100.       return      APIRET;
  101.    pragma Import (C, DosWaitEventSem, Link_Name => "DosWaitEventSem");
  102.  
  103.    function DosQueryEventSem
  104.      (F_hev     : HEV;
  105.       pulPostCt : PULONG)
  106.       return      APIRET;
  107.    pragma Import (C, DosQueryEventSem, Link_Name => "DosQueryEventSem");
  108.  
  109.    function DosCreateMutexSem
  110.      (pszName   : PSZ;
  111.       F_phmtx   : PHMTX;
  112.       flAttr    : ULONG;
  113.       fState    : BOOL32)
  114.       return      APIRET;
  115.    pragma Import (C, DosCreateMutexSem, Link_Name => "DosCreateMutexSem");
  116.  
  117.    function DosOpenMutexSem
  118.      (pszName   : PSZ;
  119.       F_phmtx   : PHMTX)
  120.       return      APIRET;
  121.    pragma Import (C, DosOpenMutexSem, Link_Name => "DosOpenMutexSem");
  122.  
  123.    function DosCloseMutexSem
  124.      (F_hmtx    : HMTX)
  125.       return      APIRET;
  126.    pragma Import (C, DosCloseMutexSem, Link_Name => "DosCloseMutexSem");
  127.  
  128.    function DosRequestMutexSem
  129.      (F_hmtx    : HMTX;
  130.       ulTimeout : ULONG)
  131.       return      APIRET;
  132.    pragma Import (C, DosRequestMutexSem, Link_Name => "DosRequestMutexSem");
  133.  
  134.    function DosReleaseMutexSem
  135.      (F_hmtx    : HMTX)
  136.       return      APIRET;
  137.    pragma Import (C, DosReleaseMutexSem, Link_Name => "DosReleaseMutexSem");
  138.  
  139.    function DosQueryMutexSem
  140.      (F_hmtx    : HMTX;
  141.       F_ppid    : PPID;
  142.       F_ptid    : PTID;
  143.       pulCount  : PULONG)
  144.       return      APIRET;
  145.    pragma Import (C, DosQueryMutexSem, Link_Name => "DosQueryMutexSem");
  146.  
  147.    function DosCreateMuxWaitSem
  148.      (pszName   : PSZ;
  149.       F_phmux   : PHMUX;
  150.       cSemRec   : ULONG;
  151.       pSemRec   : PSEMRECORD;
  152.       flAttr    : ULONG)
  153.       return      APIRET;
  154.    pragma Import (C, DosCreateMuxWaitSem, Link_Name => "DosCreateMuxWaitSem");
  155.  
  156.    function DosOpenMuxWaitSem
  157.      (pszName   : PSZ;
  158.       F_phmux   : PHMUX)
  159.       return      APIRET;
  160.    pragma Import (C, DosOpenMuxWaitSem, Link_Name => "DosOpenMuxWaitSem");
  161.  
  162.    function DosCloseMuxWaitSem
  163.      (F_hmux    : HMUX)
  164.       return      APIRET;
  165.    pragma Import (C, DosCloseMuxWaitSem, Link_Name => "DosCloseMuxWaitSem");
  166.  
  167.    function DosWaitMuxWaitSem
  168.      (F_hmux    : HMUX;
  169.       ulTimeout : ULONG;
  170.       pulUser   : PULONG)
  171.       return      APIRET;
  172.    pragma Import (C, DosWaitMuxWaitSem, Link_Name => "DosWaitMuxWaitSem");
  173.  
  174.    function DosAddMuxWaitSem
  175.      (F_hmux    : HMUX;
  176.       pSemRec   : PSEMRECORD)
  177.       return      APIRET;
  178.    pragma Import (C, DosAddMuxWaitSem, Link_Name => "DosAddMuxWaitSem");
  179.  
  180.    function DosDeleteMuxWaitSem
  181.      (F_hmux    : HMUX;
  182.       F_hsem    : HSEM)
  183.       return      APIRET;
  184.    pragma Import (C, DosDeleteMuxWaitSem, Link_Name => "DosDeleteMuxWaitSem");
  185.  
  186.    function DosQueryMuxWaitSem
  187.      (F_hmux    : HMUX;
  188.      pcSemRec   : PULONG;
  189.      pSemRec    : PSEMRECORD;
  190.      pflAttr    : PULONG)
  191.      return       APIRET;
  192.    pragma Import (C, DosQueryMuxWaitSem, Link_Name => "DosQueryMuxWaitSem");
  193.  
  194. end System.OS2Lib.Synchronization;
  195.